using IronBarCode;
using System.Drawing;
// BarcodeWriter.CreateBarcode creates a GeneratedBarcode which can be styled and exported as an Image object or file
GeneratedBarcode MyBarCode = BarcodeWriter.CreateBarcode("Any Number, String or Binary Value", BarcodeWriterEncoding.Code128);
// Save the barcode as an image file
MyBarCode.SaveAsImage("MyBarCode.png");
MyBarCode.SaveAsGif("MyBarCode.gif");
MyBarCode.SaveAsHtmlFile("MyBarCode.html");
MyBarCode.SaveAsJpeg("MyBarCode.jpg");
MyBarCode.SaveAsPdf("MyBarCode.Pdf");
MyBarCode.SaveAsPng("MyBarCode.png");
MyBarCode.SaveAsTiff("MyBarCode.tiff");
MyBarCode.SaveAsWindowsBitmap("MyBarCode.bmp");
// You may also choose to use Barcode as a native .NET object
Image MyBarCodeImage = MyBarCode.Image;
Bitmap MyBarCodeBitmap = MyBarCode.ToBitmap();
// Save the barcode as an HTML file or as a tag
MyBarCode.SaveAsHtmlFile("MyBarCode.Html");
string ImgTagForHTML = MyBarCode.ToHtmlTag();
string DataURL = MyBarCode.ToDataUrl();
// Save the barcode as a new PDF
MyBarCode.SaveAsPdf("MyBarCode.Pdf");
// Or stamp it in any position on any page of an existing PDF
MyBarCode.StampToExistingPdfPage("ExistingPDF.pdf", 200, 50, 1); // Position (200, 50) on page 1
// Or on multiple pages of an encrypted PDF
MyBarCode.StampToExistingPdfPages("ExistingPDF.pdf", 200, 50, new[] { 1, 2, 3 }, "Password123"); // Multiple pages of an encrypted PDF
// PDF stream example
using (System.IO.Stream PdfStream = MyBarCode.ToPdfStream())
{
// Stream barcode image output also works for GIF, JPEG, PDF, PNG, BMP and TIFF
}
// PNG byte array example
byte[] PngBytes = MyBarCode.ToPngBinaryData();
Imports IronBarCode
Imports System.Drawing
' BarcodeWriter.CreateBarcode creates a GeneratedBarcode which can be styled and exported as an Image object or file
Private MyBarCode As GeneratedBarcode = BarcodeWriter.CreateBarcode("Any Number, String or Binary Value", BarcodeWriterEncoding.Code128)
' Save the barcode as an image file
MyBarCode.SaveAsImage("MyBarCode.png")
MyBarCode.SaveAsGif("MyBarCode.gif")
MyBarCode.SaveAsHtmlFile("MyBarCode.html")
MyBarCode.SaveAsJpeg("MyBarCode.jpg")
MyBarCode.SaveAsPdf("MyBarCode.Pdf")
MyBarCode.SaveAsPng("MyBarCode.png")
MyBarCode.SaveAsTiff("MyBarCode.tiff")
MyBarCode.SaveAsWindowsBitmap("MyBarCode.bmp")
' You may also choose to use Barcode as a native .NET object
Dim MyBarCodeImage As Image = MyBarCode.Image
Dim MyBarCodeBitmap As Bitmap = MyBarCode.ToBitmap()
' Save the barcode as an HTML file or as a tag
MyBarCode.SaveAsHtmlFile("MyBarCode.Html")
Dim ImgTagForHTML As String = MyBarCode.ToHtmlTag()
Dim DataURL As String = MyBarCode.ToDataUrl()
' Save the barcode as a new PDF
MyBarCode.SaveAsPdf("MyBarCode.Pdf")
' Or stamp it in any position on any page of an existing PDF
MyBarCode.StampToExistingPdfPage("ExistingPDF.pdf", 200, 50, 1) ' Position (200, 50) on page 1
' Or on multiple pages of an encrypted PDF
MyBarCode.StampToExistingPdfPages("ExistingPDF.pdf", 200, 50, { 1, 2, 3 }, "Password123") ' Multiple pages of an encrypted PDF
' PDF stream example
Using PdfStream As System.IO.Stream = MyBarCode.ToPdfStream()
' Stream barcode image output also works for GIF, JPEG, PDF, PNG, BMP and TIFF
End Using
' PNG byte array example
Dim PngBytes() As Byte = MyBarCode.ToPngBinaryData()
Install-Package BarCode
Enregistrer le code-barres
IronBarcode vous permet d'enregistrer dans tous les formats de fichiers courants : PNG, JPG, GIF, TIFF, HTML, PDF, BMP, etc. Ainsi que dans les formats byte[] et Stream
Votre clé d'essai devrait être dans l'e-mail. Si elle ne l'est pas, veuillez contacter support@ironsoftware.com
Rejoignez les millions d'ingénieurs qui ont essayé IronPDF
Votre clé d'essai devrait être dans l'e-mail. Si elle ne l'est pas, veuillez contacter support@ironsoftware.com
Parlez à l'Équipe de Vente
Réservez une Consultation sans Engagement
Comment pouvons-nous vous aider :
Consultez votre flux de travail et vos points de douleur
Voyez comment d'autres entreprises répondent à leurs besoins en matière de documents .NET
Toutes vos questions reçoivent une réponse pour vous assurer d'avoir toutes les informations nécessaires. (Aucun engagement de quelque nature que ce soit.)
Obtenez un devis personnalisé pour les besoins de votre projet